Skip to content

Encode form name#2923

Open
labkey-matthewb wants to merge 5 commits intodevelopfrom
fb_encodeFormName
Open

Encode form name#2923
labkey-matthewb wants to merge 5 commits intodevelopfrom
fb_encodeFormName

Conversation

@labkey-matthewb
Copy link
Contributor

@labkey-matthewb labkey-matthewb commented Mar 25, 2026

Rationale

Support an encoding scheme for INPUT.name to avoid problems with multipart/form-data

Related Pull Requests

Changes


TestLogger.log("Generated random field name for domainKind " + _domainKind + ": " + randomFieldName);
return randomFieldName.name();
return randomFieldName.name() + "\"\'";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this temporary to test in your branch or intentionally left in?
If we want this included in the long or medium-term, these characters should be appended to the names generated on lines 673 and 676 so that they are included in the name validation (isDomainAndFieldNameInvalid)

Comment on lines +287 to +294
final String escapeChar = "%";
final String problemChars = "\\\"";
final String unclean = escapeChar + problemChars;
if (!StringUtils.containsAny(name, unclean))
return name;
var ret = FIELD_ENCODED_PREFIX + encode(name);
assert !StringUtils.containsAny(ret, problemChars);
return ret;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does this work with multi-value columns that need name encoding?
The getFormFieldName on line 270 would return something like %_[]quf_tricky%22stuff but I presume the actual name is []%_quf_tricky%22stuff.
If so, that method should be changed to work correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants